home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / apendixb.lha / appendixb / abs.h next >
Text File  |  1993-08-08  |  349b  |  22 lines

  1. / define a function for each of the various
  2. / basic types which returns the absolute value.
  3. ifndef ABS_H
  4.  define ABS_H
  5.  
  6. verload abs;
  7.  
  8. define defabs(typex)          \
  9.    inline typex abs(typex &a)      \
  10.    {                  \
  11. if (a >= 0)    return a; \
  12. else    return -a;      \
  13.    }
  14.  
  15. efabs(char)
  16. efabs(short)
  17. efabs(int)
  18. efabs(long)
  19. efabs(float)
  20. efabs(double)
  21. endif /* ABS_H */
  22.